package com.suray.basic.wcs.plc.enums;

/**
 * @author shaozn
 * @date 2020/1/22 - 13:28
 * @Description 方向枚举
 */
public enum Direction {

    STOP(0, "停止"),

    IN(1, "入库方向"),

    OUT(2, "出库方向"),

    SINGLE_CONVERY_STOP(3, "单体输送线停止"),
    ;
    private int directionNum;
    public String description;

    Direction(int directionNum, String description) {
        this.setDirectionNum(directionNum);
        this.description = description;
    }

    public static Direction parseDirection(int direction) {
        for (Direction value : Direction.values()) {
            if (value.directionNum == direction) {
                return value;
            }
        }

        throw new RuntimeException("错误的方向：" + direction);
    }

    public int getDirectionNum() {
        return directionNum;
    }

    public void setDirectionNum(int directionNum) {
        this.directionNum = directionNum;
    }
}
